<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.parent{
			/* 伸缩盒 */
			display: flex;
			/* 设置换行 */
			flex-wrap: wrap;
			/* 设置主轴对齐方式 */
			justify-content: center;
		}
		.child{
			height: 100px;
			flex: 0 1 300px;
			border: 1px solid royalblue;
			margin: 10px;
		}
	</style>
</head>
<body>
	<div class="parent">
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
		<div class="child"></div>
	</div>
</body>
</html>